refactored/smallerized code. use layout properties. removed unnecessary constants. comments.