Cleaned code, moved to include file